Product : ISaGRAF V3

Date    : updated November-1999

File    : Ticorcc.How generated C code is integrated to the target.htm

Subject : HOW GENERATED C CODE IS INTEGRATED IN THE TARGET

Keywords: C code - SCC

____________________________________________________________________

Below are some more explanations about how the "C" code generation is integrated into the ISaGRAF system.

1) What is done on the workbench

The "C" code generation appears as one target type in the "Compiler Options" dialog box. When this option is selected, several files are generated by the ISaGRAF compiler:

- <ProgName>.c and <ProgName.h> : C source corresponding to the IEC program <ProgName>

- appli.h and appli.h : main definitions concerning the application code

All files are created into the project directory.

Note that if you have selected the "CC86M: C source code (3.04)" option, only appli.c and appli.h are generated.

There is one .c and one .h file per program only for the SCC option.

2) What is done in the target

On the target side, using the IDK, the kernel source code must be recompiled, with one more flag set in TASY0DEF.H:

Note that with IIO, kernel libraries are already delivered for TIC and for C.

#define LGC

In this case, all .h files must be located in the ISaGRAF DEFS directory.

Then IsaAplC library must be regenerated.

In the case of SCC option, compiling utility to generate IsaAplC library must be completed with the .c files corresponding to all programs of the application.

Other target components (OEM, C functions and function blocks, COM and SYS layers) are still linked with the kernel files.

Please consult Tio.txt to see integration procedures.

3) Comparison between C code and TIC code

The following diagrams show the difference between TIC and "C" implementations, and show the links between the ISaGRAF kernel, and what is generated by the Workbench compiler:

- TIC implementation:

- "C" Code Generation

In the case of "C" source code generation, the TIC interpreter is replaced by direct calls to a "C" written routine. SFC engine, data base and other layers still operate.

4) Generated code modularity

The following different parts are generated as "C" source code:

The data base configuration data and procedures (called at init to build the data base) has a global scope and is modified each time something changes in the dictionary of variables, I/O wiring or other configuration features.

The SFC chart is the global application SFC chart coded as binary lists, and it is modified each time an SFC structure (steps, transitions and links) is touched in an SFC program.

Other C procedures correspond to the code of non SFC program, step action blocks and transition receptivity equations. Below are the different entry points generated (different C routines):

- one routine for each non SFC cyclic program

- one routine for each function or sub-program

- one routine for each transition

- one routine for each step, when it becomes active (P actions)

- one routine for each step, when it becomes inactive (opposite of P actions)

- one routine for each step, when it is active (N actions)

5) restrictions

- When SCC option is selected, the optimizer is not active.

- The SCC generation is not possible with IL programs

- you should not generate TIC code when SCC option is checked

____________________________________________________________________

Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.